package com.fsy.its.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fsy.its.entity.Dtu;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface DtuMapper extends BaseMapper<Dtu> {

    @Select("SELECT d.id, d.specs, d.host_brand, d.host_model, d.state, \n" +
            "p.id as park_id, p.name, p.address as park_address, \n" +
            "b.id as building_id, b.name as building_name \n" +
            "FROM its_dtu d \n" +
            "LEFT JOIN its_building b ON(d.building_id=b.id) \n" +
            "LEFT JOIN its_park p ON(b.park_id=p.id) \n" +
            "WHERE d.id=#{dtuId}")
    Dtu getDtuById(@Param("dtuId") String dtuId);
}
